<?php
if ( $handle = opendir("./images") ) {  
	while ( ($file = readdir($handle)) !== false ){  
		if ( $file != ".." && $file != "." ){
			$nfile = "./images/" . $file;
			$fp  = fopen($nfile, 'rb', 0);
			$base64 = chunk_split(base64_encode(fread($fp,filesize($nfile))));
			$ext = explode(".", $file);
			echo '"'.$ext[0] .'" => ' . '"' . $base64 . '",<br>';
			fclose($fp);
		}  
	}  
	closedir($handle);   
}
die();
//'<img src="data:image/gif;base64,'.$base64.'">' . 
?>